import pytest
from selenium import webdriver
import time
driver = None


# 关联页面  让页面都在一个session中 不需要重新登录
@pytest.fixture(scope="session")
def browser():
    global driver
    if driver is None:
        driver = webdriver.Chrome()
        driver.maximize_window()
        driver.implicitly_wait(10)
    yield driver
    # 执行完测试用例之后关闭浏览器
    time.sleep(2)
    driver.quit()
